package org.javaongems.client.forms;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;

public class DefaultFormStylerImpl {
	protected Form form; 
	protected Element formElement;
	
	public void styleOutOfBox(Form frm) {
		form = frm;
		
		styleBorders();
		styleTitleBar();
	}
	
	protected void styleTitleBar() {
		Element elem = form.titleBar.getElement();
		DOM.setStyleAttribute(elem, "backgroundColor", "#7596c6");
		DOM.setStyleAttribute(elem, "color", "white");
		DOM.setStyleAttribute(elem, "overflow", "hidden");
		DOM.setStyleAttribute(elem, "verticalAlign", "middle");
	}
	
	protected void styleBorders() {
		Element elem = form.getElement();
		DOM.setStyleAttribute(elem, "border", "1px solid");
		DOM.setStyleAttribute(elem, "borderColor", "ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight");
		DOM.setStyleAttribute(elem, "backgroundColor", "ThreeDFace");
		DOM.setStyleAttribute(elem, "margin", "1px 1px 1px 1px");
	}
}
